<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        canvas{
            border: 1px solid red;
        }
    </style>
</head>
<!--作业4：画一个心-->
<body>
<canvas width="600" height="600" id="can">您的浏览器不支持画布</canvas>
<script type="text/javascript">
    var can=document.getElementById("can");
    var pen=can.getContext("2d");
    //画画之前先清除一下画布，然后在开始作画
    pen.clearRect(0,0,can.width,can.height);
    pen.moveTo(214,287);
    pen.bezierCurveTo(4,120,105,33,217,123);
    pen.stroke();
    pen.moveTo(217,123);
    pen.bezierCurveTo(295,35,459,96,214,287);
    pen.fillStyle="red";
    pen.fill();
    pen.stroke();
</script>
</body>






</html>